package com.lhf.springcloud.controller;

import com.lhf.springcloud.entity.TeacherData;
import com.lhf.springcloud.entity.User;
import com.lhf.springcloud.impl.TeacherServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
@Api(value = "老师接口",tags = "老师接口")
public class TeacherController {
    @Autowired
    private TeacherServiceImpl teacherService;
    //@ApiOperation(value = "添加用户")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public String addNewUser(@RequestBody TeacherData teacherDatas){
        TeacherData teacherData = new TeacherData();
        List<TeacherData> list= new ArrayList<>();
        teacherData.setTeacherName(teacherDatas.getTeacherName());
        teacherData.setTeacherLevel(teacherDatas.getTeacherLevel());
        list.add(teacherData);
        teacherService.addCourse(list);
        return "Saved";
    }
}
